package com.flow.asyncflow.web.controller;

import com.flow.asyncflow.core.entity.flowChart.AsyncFlowChartEntity;
import com.flow.asyncflow.core.utils.flowChart.AsyncFlowNodeChart;
import com.flow.asyncflow.core.utils.msg.AsyncFlowSendMsg;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
@RequestMapping("/asyncFlowWeb")
public class AsyncFlowWebController {

    @RequestMapping("/flowDiagramWeb")
    public String flowDiagram(Model model, @RequestParam("trackGuid") String trackGuid) {

        AsyncFlowChartEntity asyncFlowChartEntity = AsyncFlowNodeChart.getFlowChartEntity(trackGuid);
        model.addAttribute("asyncFlowNodeDataArray", asyncFlowChartEntity.getGoJsNodeEntityList());
        model.addAttribute("asyncFlowNodeLinkData", asyncFlowChartEntity.getGoJsLinkDataEntityList());
        model.addAttribute("asyncFlowTitle", asyncFlowChartEntity.getAsyncFlowTitle());

        return "flowDiagram";
    }

    @RequestMapping("/codeGenerationWeb")
    public String asyncFlowCodeGeneration() {

        return "asyncFlowCodeGeneration";
    }

    @RequestMapping("/asyncFlowMonitorWeb")
    public String asyncFlowMonitor() {
        return "asyncFlowMonitor";
    }
}
